package IO.字节流;

import java.io.*;


public class ByteStream {
    public static void main(String[] args) throws IOException {
        File inputFile = new File("D:/IOFile/test/word.txt");
        File outputFile = new File("D:/IOFile/test/copy.txt");
        if(!outputFile.exists()){
            outputFile.createNewFile();
        }
        FileInputStream fis = new FileInputStream(inputFile);
        FileOutputStream fos = new FileOutputStream(outputFile);
        int c = -1;
        System.out.println("int型数据的ASCll码值"+c);
        System.out.println("到二进制字符串"+Integer.toBinaryString(c));
        while((c = fis.read()) != -1){
            System.out.println(c);
            fos.write(c);
        }

        System.out.println("=================");
        //读取图片
        File inputFile1 = new File("C:\\Users\\mfg\\Desktop\\preview.jpg");
        File outputFile1 = new File("D:/IOFile/test/泰妍.jpg");
        if(!outputFile1.exists()){
            outputFile1.createNewFile();
        }
        FileInputStream fileInputStream = new FileInputStream(inputFile1);
        FileOutputStream fileOutputStream = new FileOutputStream(outputFile1);
        int ch = -1;
        while((ch = fileInputStream.read()) != -1){
            fileOutputStream.write(ch);
        }





    }
}
